<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>注册易购GO,注册成为易购GO会员 - 易购GO</title>
<meta name="keywords" content="易购GO,注册会员" />
<meta name="description" content="易购GO,注册易购GO,注册成为易购GO会员" />
<{assign var="layout" value="3"}>
<{include file="../_meta.html"}>
</head>

<body>
<{include file="../_top.html"}>
<div id="Container">

	<!-- header -->
	<div id="Header" class="clearfix">
		<{include file="../_header.html"}>
	</div>
	<!-- /header -->
	
	<!-- body -->
	<div id="Body" class="clearfix">
	
		<!-- main -->
		<div id="Wrapper">
			<div id="Main">
				<div id="loginReg" class="content clearfix">
					<!-- 左 -->
					<div class="left">
						<form id="formRegister" action="<{url r='user/site/register'}>" method="POST" class="regPage">
							<div class="line">
								<label class="hd">用户名(邮箱)：</label>
								<input type="text" class="input middle" name="username" />
							</div>
							<div class="line">
								<label class="hd">密码：</label>
								<input type="password" class="input middle" name="password" />
							</div>
							<div class="line">
								<label class="hd">确认密码：</label>
								<input type="password" class="input middle" name="password2" />
							</div>
							<div class="line">
								<label class="hd">验证码：</label>
								<input type="text" class="input min" name="captcha" />
								<img id="captchaImg" src="<{url r='user/site/captcha'}>" />
							</div>
							<div class="line">
								<label class="hd">&nbsp;</label>
								<input id="chkRememberme" type="checkbox" name="rememberme" value="1">
								<label for="chkRememberme">记住用户名</label>
							</div>
							<div class="line">
								<label class="hd">&nbsp;</label>
								<input type="submit" class="userBtn" value="注册" />
							</div>
						</form>
						
						<form id="formLogin" action="<{url r='user/site/login'}>" method="POST" class="logPage" style="display:none;">
							<div class="line">
								<label class="hd">用户名(邮箱)：</label>
								<input type="text" class="input middle" name="username" />
							</div>
							<div class="line">
								<label class="hd">密码：</label>
								<input type="password" class="input middle" name="password" />
							</div>
							<div class="line">
								<label class="hd">&nbsp;</label>
								<input id="chkRememberme" type="checkbox" name="rememberMe" value="1">
								<label for="chkRememberme">记住用户名</label>
							</div>
							<div class="line">
								<label class="hd">&nbsp;</label>
								<input type="submit" class="userBtn" value="登录" />
							</div>
						</form>
					</div>
					
					<!-- 右 -->
					<div class="right">
						<div class="regPage">
							<p>已有易购GO会员？请直接登录<a class="aLogin" href="javascript:;">登录</a></p>
							<p>您也可以用站外账号登录：</p>
						</div>
						<div class="logPage" style="display:none;">
							<p>还没有易购GO会员？赶紧注册吧<a class="aRegister" href="javascript:;">免费注册</a></p>
							<p>您也可以用站外账号登录：</p>
						</div>
						<ul id="homeOauth" class="open-auth clearfix">
							<li><a target="_blank" href="<{url r='user/login/QQ'}>" class="qq"></a></li>
							<li><a target="_blank" href="<{url r='user/login/Sina'}>" class="sina"></a></li>
						</ul>
					</div>
				</div>
			</div>
		</div>
		<!-- /main -->
		
		<!-- sidebar -->
		<div id="SideBar"></div>
		<!-- /sidebar -->
	</div>
	<!-- /body -->
	
	<!-- footer -->
	<div id="Footer" class="clearfix"><{include file="../_footer.html"}></div>
	<!-- /footer -->
</div>
</body>
</html>

<!-- JS -->
<{JS}>
<script type="text/javascript">
$(function() {
	/// 登录表单
	$("#formLogin").validate({
		rules: {
			username: {
				required: true,
				email: true
			},
			password: {
				required: true
			}
		},
		messages: {
			username: {
				required: "用户名不能为空",
				email: "填写无效邮箱格式的用户名"
			},
			password: {
				required: "密码不能为空"
			}
		},
		submitHandler: function() {
			$("#formLogin").ajaxSubmit({
				type: "POST",
				success: function(data) {
					var tmp = data.split("|");
					if (tmp[0] == "10000") {
						document.location.href = "<{url r='user/main'}>";
					} else {
						/// 错误提示
						var v = $("#formLogin").validate();
						var element = $("#formLogin input[name='username']");
						v.showLabel(element[0], tmp[1]);
						v.defaultShowErrors();
					}
				}
			});
			
			return false;
		}
	});
	
	/// 注册表单
	$("#formRegister").validate({
		rules: {
			username: {
				required: true,
				email: true,
				maxByte: 100
			},
			password: {
				required: true,
				minlength: 6,
				maxlength: 10
			},
			password2: {
				required: true,
				minlength: 6,
				maxlength: 10,
				equalTo: "#formRegister input[name='password']"
			},
			captcha: "required"
		},
		messages: {
			username: {
				required: "用户名不能为空",
				email: "填写无效邮箱格式的用户名",
				maxByte: "用户名不能超过100个字符"
			},
			password: {
				required: "密码不能为空",
				minlength: "密码至少要6位",
				maxlength: "密码不能超过10位"
			},
			password2: {
				required: "密码确认不能为空",
				minlength: 	"密码确认至少要6位",
				maxlength: "密码确认不能超过10位",
				equalTo:"两次输入的密码不一致"
			},
			captcha: "验证码不能为空"
		},
		errorPlacement: function(error, element) {
			error.appendTo(element.parent("div"));
		},
		submitHandler: function() {
			$("#formRegister").ajaxSubmit({
				type: "POST",
				success: function(data) {
					var tmp = data.split("|");
					if (tmp[0] == "10000") {
						document.location.href = "<{url r='user/main'}>";
					} else {
						/// 错误提示
						var v = $("#formRegister").validate();
						var element = $("#formRegister input[name='username']");
						v.showLabel(element[0], tmp[1]);
						v.defaultShowErrors();
					}
				}
			});
			
			return false;
		}
	});
	
	///
	function captchaRefresh() {
		$("#captchaImg").attr("src", "<{url r='user/site/captcha'}>?" + Math.random());
	}
	
	///
	$("#captchaImg")
		.css("cursor", "pointer")
		.attr("title", "看不清？点击更换另一个验证码。")
		.click(function() {
			captchaRefresh();
		});
	
	///
	function showRegPage() {
		$(".regPage").show();
		$(".logPage").hide();
		document.location.href = "<{url r='user/site/panel'}>#2";
	}
	
	///
	function showLogPage() {
		$(".logPage").show();
		$(".regPage").hide();
		document.location.href = "<{url r='user/site/panel'}>#1";
	}
	
	///
	$(".aLogin").click(function() {
		showLogPage();
		return false;
	});
	$(".aRegister").click(function() {
		showRegPage();
		return false;
	});
	
	///
	var tmp = document.location.href.split("#");
	if (tmp[1]=="2") {
		showRegPage();
	} else if (tmp[1]=="1") {
		showLogPage();
	}
});
</script>
